<template>
  <view>
    <z-paging
      ref="paging"
      v-model="dataList"
      @query="queryList"
      :fixed="true"
      :auto="false"
      :auto-show-back-to-top="true"
      :empty-view-img="`${getImageUrl('empty.png')} `"
      empty-view-text="暂无订单数据~"
      :empty-view-img-style="imgStyle"
    >
      <view class="" slot="top">
        <u-navbar title="选定施工队" height="50"></u-navbar>
        <view class="search-box">
          <u-search
            placeholder="搜索施工队"
            width="100"
            :show-action="false"
            v-model="keyword"
          ></u-search>
          <view style="font-size: 30rpx"> 搜索 </view>
        </view>
      </view>
      <view class="" style="padding: 20rpx">
        <view
          class="team-item"
          v-for="(item, index) in dataList"
          :key="index"
          @click="onCheck(item, index)"
        >
          <view class="team-item-lef">
            <view class="check-cir" :style="current === index ? 'background:#0F76BC' : ''"></view>
          </view>
          <view class="team-item-rig">
            <view class="team-item-top">
              <view class="team-name" v-if="item.resume">
                {{ item.resume.name }}
              </view>
              <view class="sign"> 已实名 </view>
            </view>

            <!-- <view class="team-item-content">
								<text class="">
									项目报价&nbsp;&nbsp;¥{{(item.acceptPrice * 0.01).toFixed(2)}}
								</text>
								<view class="money">
									保证金
									<u-icon style="margin: 0 20rpx;" name="/static/img/gzsm.png" size="35"></u-icon>
									¥{{(item.depositPrice * 0.01).toFixed(2)}}
								</view>
							</view> -->

            <view class="team-floor" style="color: #999999">
              报名时间:{{ formatTime(item.createTime) }}
            </view>

            <view style="" style="display: flex">
              <view class="info-top-btn1" @click.stop.prevent="onMobile(item)" style="flex: 1">
                联系TA
              </view>
            </view>
            <view class="" style="display: flex; margin: 30rpx; font-size:">
              <view class="" style="flex: 1"> </view>
              <view @click.stop.prevent="routeTo(item)" class="info-top-btn">
                查看详情
                <u-icon
                  style="margin: 10rpx; vertical-align: middle"
                  name="/static/img/more.png"
                  size="18"
                ></u-icon>
              </view>
            </view>
          </view>
        </view>
      </view>
    </z-paging>
    <view v-if="isCheck" @click="onConfirm" class="confrim-btn"> 确认选择 </view>
  </view>
</template>

<script>
export default {
  data() {
    return {
      id: '',
      keyword: '',
      filterCity: [],
      current: '',
      options2: [
        {
          label: '全部类型',
          value: 1
        },
        {
          label: '住房',
          value: 2
        },
        {
          label: '体育',
          value: 3
        }
      ],
      options3: [
        {
          label: '全部类型',
          value: 1
        },
        {
          label: '正在进行',
          value: 2
        },
        {
          label: '即将开始',
          value: 3
        }
      ],
      dataList: [],
      checkTeam: '',
      isCheck: ''
    }
  },
  onLoad(e) {
    this.id = e.id
    this.isCheck = e.isCheck
    this.queryList()
  },
  computed: {
    formatTime() {
      return (e) => this.$utils.parseTime(e)
    }
  },

  methods: {
    queryList(pageNo = 1, pageSize = 10) {
      this.$u
        .get(
          `/app-api/construction/project-enroll/list?pageNo=${pageNo}&pageSize=${pageSize}&projectId=${this.id}&payed=true`
        )
        .then((res) => {
          this.$refs.paging.complete(res.data)
        })
    },
    checkProvince(p, index) {
      this.current = index
      this.filterCity = city[index]
    },
    checkCity(c) {
      this.pitchOnCity = c
      setTimeout(() => {
        this.$refs.uDropdown.close()
      }, 100)
    },
    onCheck(e, i) {
      this.current = i
      this.checkTeam = e
    },
    onConfirm() {
      uni.$emit('checkItem', this.checkTeam)
      uni.navigateBack()
    },
    routeTo(e) {
      uni.navigateTo({
        url: '/other/construction-team-detail/construction-team-detail?id=' + e.userId
      })
    },
    onMobile(e) {
      uni.makePhoneCall({
        phoneNumber: e.contact
      })
    }
  }
}
</script>

<style>
page {
  background-color: #eeeeef;
}
.search-box {
  display: flex;
  padding: 15rpx;
  background-color: #fff;
  align-items: center;
}

.team-item {
  height: 320rpx;
  border: #e6e6e6 2rpx solid;
  border-radius: 12rpx;
  line-height: 50rpx;
  padding: 15rpx;
  background-color: #fff;
  display: flex;
  margin-bottom: 15rpx;
}

.team-item-lef {
  flex-basis: 55rpx;
  display: flex;
  justify-content: center;
}

.check-cir {
  width: 40rpx;
  height: 40rpx;
  border: #999999 solid 2rpx;
  border-radius: 40rpx;
  margin-top: 65rpx;
}

.team-item-rig {
  flex-basis: 100%;
}

.team-item-top {
  border-bottom: 2rpx #ededed solid;
}
.team-name {
  display: inline-block;
  font-size: 35rpx;
  margin-bottom: 20rpx;
}
.sign {
  display: inline-block;
  font-size: 28rpx;
  padding: 2rpx 18rpx;
  background-color: #8cc340;
  color: #fff;
  border-radius: 30rpx;
  margin-left: 10rpx;
}

.team-item-content {
  margin: 15rpx 0;
  position: relative;
}
.money {
  position: absolute;
  top: 0;
  right: 2rpx;
  display: flex;
  align-items: center;
}
.info-top-btn {
  display: inline-block;
  font-size: 30rpx;
  color: #999999;
}

.confrim-btn {
  position: fixed;
  bottom: 10rpx;
  left: 50%;
  transform: translateX(-50%);
  width: 710rpx;
  padding: 20rpx 0;
  text-align: center;
  border-radius: 40rpx;
  background-color: #0f76bc;
  font-size: 32rpx;
  color: #fff;
}

.info-top-btn1 {
  flex-shrink: 1;
  width: 120rpx;
  height: 80rpx;
  line-height: 80rpx;
  text-align: center;
  display: inline-block;
  font-size: 30rpx;
  background-color: #0f76bc;
  border-radius: 30rpx;
  color: #fff;
}
</style>
